/*
 * cad_setores.java
 *
 * LICENÇA CC-GNU LGPL
 * 
 * EXCLUSÃO DE GARANTIA 
1.COMO A BIBLIOTECA É LICENCIADA ELA TERÁ TOTAL GARANTIA DE SUPORTE TÉCNICO,
  MAS CASO O CÓDIGO-FONTE SOFRA ALTERAÇÕES, NÃO HAVERÁ NENHUMA GARANTIA PARA A 
  BIBLIOTECA, NO LIMITE PERMITIDO PELA LEI APLICÁVEL. EXCETO QUANDO DE OUTRA FORMA
  ESTABELECIDO POR ESCRITO, OS TITULARES DOS DIREITOS AUTORAIS E/OU OUTRAS PARTES 
  FORNECEM A BIBLIOTECA "NO ESTADO EM QUE SE ENCONTRA", SEM NENHUMA GARANTIA DE 
  QUALQUER TIPO, TANTO EXPRESSA COMO IMPLÍCITA, INCLUINDO, DENTRE OUTRAS, AS GARANTIAS
  IMPLÍCITAS DE COMERCIABILIDADE E ADEQUAÇÃO PARA UMA FINALIDADE ESPECÍFICA. 
  O RISCO INTEGRAL QUANTO À QUALIDADE E DESEMPENHO DA BIBLIOTECA É ASSUMIDO POR VOCÊ.
  CASO A BIBLIOTECA CONTENHA DEFEITOS, VOCÊ ARCARÁ COM OS CUSTOS DE TODOS OS SERVIÇOS,
  REPAROS OU CORREÇÕES NECESSÁRIAS. 

 2.EM NENHUMA CIRCUNSTÂNCIA, A MENOS QUE EXIGIDO PELA LEI APLICÁVEL OU ACORDADO POR 
   ESCRITO, QUALQUER TITULAR DE DIREITOS AUTORAIS OU QUALQUER OUTRA PARTE QUE POSSA 
   MODIFICAR E/OU REDISTRIBUIR A BIBLIOTECA, CONFORME PERMITIDO ACIMA, SERÁ RESPONSÁVEL 
   PARA COM VOCÊ POR DANOS, INCLUINDO ENTRE OUTROS QUAISQUER DANOS GERAIS, ESPECIAIS, 
   FORTUITOS OU EMERGENTES, ADVINDOS DO USO OU IMPOSSIBILIDADE DE USO DA BIBLIOTECA 
   (INCLUINDO, ENTRE OUTROS, PERDA DE DADOS, DADOS SENDO GERADOS DE FORMA IMPRECISA, 
   PERDAS SOFRIDAS POR VOCÊ OU TERCEIROS OU A IMPOSSIBILIDADE DA BIBLIOTECA DE OPERAR 
   COM QUALQUER OUTRO SOFTWARE), MESMO QUE ESSE TITULAR, OU OUTRA PARTE, TENHA SIDO 
   AVISADO SOBRE A POSSIBILIDADE DESSES DANOS.

 * 
 * 
 * 
 * 
 * 
 * 
 * Created on 4 de Novembro de 2008, 19:20
 */

package cadastros;




import java.text.ParseException;
import utilitarios.conexao;
import java.sql.*;
import javax.swing.*;
import java.awt.EventQueue.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import javax.xml.bind.ParseConversionEvent;
import principal.tela_principal;
import utilitarios.data;



/**
 *
 * @author  Shinigami
 */
public class hd_fechados extends javax.swing.JFrame {
    
    
    

    public static conexao con_setores,con_hdsf, con_atualiza;
    public static SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
    String seta_look = "com.birosoft.liquid.LiquidLookAndFeel";
    public static String datafechado , dataabert;
    public static java.util.Date dataabt ;
    
    public static int navega = 0; //variavel para saber qual botão foi clicado
    int inicia_combo = 0;
    int modo_banco = 0; //se modo_banco = 1 --> modo salvar
                        //se modo_banco = 2 --> modo alterar
    
    
    
    data mostra_data;
    
    

    
    
    /** Creates new form cad_maquinas */
    public hd_fechados() {
        initComponents();
        
        
        
        con_setores = new conexao();
        con_setores.conecta();
        
        con_hdsf = new conexao();
        con_hdsf.conecta();
       
        con_atualiza = new conexao();
        con_atualiza.conecta();
        
        mostra_data = new data();
        mostra_data.le_data();
        
        
        
        label_data.setText(mostra_data.dia+"/"+mostra_data.mes+"/"+mostra_data.ano);
        
        lb_tecnico.setText(hd_principal.lb_tec.getText()); 
        
        
        
        
        
      
        lookandfeel();
        travar_campos();
        
        
                    
             
        
        
     
   
    }    
    


    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel8 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        ta_obs = ta_obs = new JTextArea();
        ta_obs.setDocument( new PlainDocument()  
            {  
                @Override  
                public void insertString( int offs, String str, AttributeSet a )  
                throws BadLocationException  
                {  
                    super.insertString( offs, str.toUpperCase(), a );  
                }  
            } );  ;
            lb_nmaq = new javax.swing.JLabel();
            lb_ip = new javax.swing.JLabel();
            lb_ncall = new javax.swing.JLabel();
            lb_setor = new javax.swing.JLabel();
            lb_tipop = new javax.swing.JLabel();
            label_data = new javax.swing.JLabel();
            bt_primeiro = new javax.swing.JButton();
            bt_anterior = new javax.swing.JButton();
            bt_proximo = new javax.swing.JButton();
            bt_ultimo = new javax.swing.JButton();
            lb_nuser = new javax.swing.JLabel();
            lb_tecnico = new javax.swing.JLabel();
            lb_tecresp = new javax.swing.JLabel();
            lb_dataab = new javax.swing.JLabel();
            lb_tecabert = new javax.swing.JLabel();
            lb_duracao = new javax.swing.JLabel();
            lb_horaf = new javax.swing.JLabel();
            lb_dataab1 = new javax.swing.JLabel();
            lb_horaab = new javax.swing.JLabel();

            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("Chamados Fechados");
            setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            setResizable(false);
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosed(java.awt.event.WindowEvent evt) {
                    formWindowClosed(evt);
                }
            });

            jLabel8.setText("Descrição:");

            ta_obs.setColumns(20);
            ta_obs.setEditable(false);
            ta_obs.setRows(5);
            jScrollPane2.setViewportView(ta_obs);

            lb_nmaq.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Nome da Máquina", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_ip.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "IP", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_ncall.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Nº ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_setor.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Setor", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_tipop.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tipo do Problema", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            label_data.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Data Atual", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            bt_primeiro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/primeiro_registro.gif"))); // NOI18N
            bt_primeiro.setMnemonic('w');
            bt_primeiro.setToolTipText("Primeiro registro (ALT + W)");
            bt_primeiro.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    bt_primeiroActionPerformed(evt);
                }
            });

            bt_anterior.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/registro_anterior.gif"))); // NOI18N
            bt_anterior.setMnemonic('a');
            bt_anterior.setToolTipText("Registro anterior (ALT + A)");
            bt_anterior.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    bt_anteriorActionPerformed(evt);
                }
            });

            bt_proximo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/proximo_registro.gif"))); // NOI18N
            bt_proximo.setMnemonic('d');
            bt_proximo.setToolTipText("Próximo registro (ALT + D)");
            bt_proximo.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    bt_proximoActionPerformed(evt);
                }
            });

            bt_ultimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/ultimo_registro.gif"))); // NOI18N
            bt_ultimo.setMnemonic('s');
            bt_ultimo.setToolTipText("Último registro (ALT + S)");
            bt_ultimo.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    bt_ultimoActionPerformed(evt);
                }
            });

            lb_nuser.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Usuário", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_tecnico.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Técnico", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_tecresp.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Fechado por", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_dataab.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Fechado em", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_tecabert.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Aberto por", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_duracao.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Duração", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_horaf.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Hora", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_dataab1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Aberto em", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            lb_horaab.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Hora", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N

            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel8)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 425, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(48, Short.MAX_VALUE))
                .addGroup(layout.createSequentialGroup()
                    .addGap(147, 147, 147)
                    .addComponent(bt_primeiro, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(bt_anterior, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(bt_proximo, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(bt_ultimo, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(180, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(lb_dataab1, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(lb_horaab, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(lb_dataab, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(lb_horaf, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(2, 2, 2)
                            .addComponent(lb_duracao, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(lb_ncall, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(label_data, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(lb_nuser, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(lb_setor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(lb_tipop, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(lb_nmaq, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
                                        .addComponent(lb_ip, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE))))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(lb_tecnico, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                                .addComponent(lb_tecabert, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(lb_tecresp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addGap(20, 20, 20))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(lb_ncall, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lb_nuser, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lb_tecnico, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(label_data, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(lb_setor, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lb_nmaq, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lb_tecabert, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(lb_ip, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lb_tipop, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(lb_tecresp, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel8)
                            .addGap(88, 88, 88))
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(bt_anterior, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(bt_proximo, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(bt_primeiro, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(1, 1, 1))
                        .addComponent(bt_ultimo, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(lb_duracao, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lb_horaf, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lb_dataab, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lb_horaab, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lb_dataab1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap())
            );

            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-545)/2, (screenSize.height-436)/2, 545, 436);
        }// </editor-fold>//GEN-END:initComponents

private void bt_primeiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_primeiroActionPerformed
try
        {
           navega = 1;
            hd_principal.con_fecha.resultset.first();
            mostrar_dados();
                       
         }
        catch(SQLException erro)
        {
            JOptionPane.showMessageDialog(null,"Não localizou dados "+erro);
        }
}//GEN-LAST:event_bt_primeiroActionPerformed

private void bt_anteriorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_anteriorActionPerformed
try
        {
            if (hd_principal.con_fecha.resultset.isFirst())
            {
                navega = 1;
            } 
            hd_principal.con_fecha.resultset.previous();
            mostrar_dados(); 
            
                        
        }
        catch(SQLException erro)
        {
            JOptionPane.showMessageDialog(null,"Não localizou dados "+erro);
        }
}//GEN-LAST:event_bt_anteriorActionPerformed

private void bt_proximoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_proximoActionPerformed
try
        {
        if (hd_principal.con_fecha.resultset.isLast())
            {
                navega = 2;
            }
           hd_principal.con_fecha.resultset.next();
            mostrar_dados(); 
        }
        catch(SQLException erro)
        {
            JOptionPane.showMessageDialog(null,"Não localizou dados "+erro);
        }
}//GEN-LAST:event_bt_proximoActionPerformed

private void bt_ultimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_ultimoActionPerformed
try
        {
            navega = 2;
            hd_principal.con_fecha.resultset.last();
            mostrar_dados(); 
            
              
        }
        catch(SQLException erro)
        {
            JOptionPane.showMessageDialog(null,"Não localizou dados "+erro);
        }
}//GEN-LAST:event_bt_ultimoActionPerformed

private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed

    hd_principal.tb_fechado.setVisible(true);
    
}//GEN-LAST:event_formWindowClosed
 
    
     /**
    * @param args the command line arguments
    */
public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new hd_fechados().setVisible(true);
            }
        });
    }
   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bt_anterior;
    private javax.swing.JButton bt_primeiro;
    private javax.swing.JButton bt_proximo;
    private javax.swing.JButton bt_ultimo;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JScrollPane jScrollPane2;
    public static javax.swing.JLabel label_data;
    public static javax.swing.JLabel lb_dataab;
    public static javax.swing.JLabel lb_dataab1;
    public static javax.swing.JLabel lb_duracao;
    public static javax.swing.JLabel lb_horaab;
    public static javax.swing.JLabel lb_horaf;
    public static javax.swing.JLabel lb_ip;
    public static javax.swing.JLabel lb_ncall;
    public static javax.swing.JLabel lb_nmaq;
    public static javax.swing.JLabel lb_nuser;
    public static javax.swing.JLabel lb_setor;
    public static javax.swing.JLabel lb_tecabert;
    public static javax.swing.JLabel lb_tecnico;
    public static javax.swing.JLabel lb_tecresp;
    public static javax.swing.JLabel lb_tipop;
    public static javax.swing.JTextArea ta_obs;
    // End of variables declaration//GEN-END:variables

   
    
    



public void travar_campos()
{
    
    
    //bt_gravar.setEnabled(false);
    //jm_salvar.setEnabled(false);
    ta_obs.setEditable(false);
    
    
            
}

public void destrava()
{
    
    //bt_gravar.setEnabled(true);
    //jm_salvar.setEnabled(true);
    ta_obs.setEditable(true);
  
    
}
    



public void lookandfeel()
     
    {
             
         try
        {
            
            UIManager.setLookAndFeel(seta_look);
            SwingUtilities.updateComponentTreeUI(this);
            
        }        
        catch(Exception erro)
        {
            JOptionPane.showMessageDialog(null,erro);
        
        } 
        }   


    
 public static void mostrar_dados()
    {
         try
        {
            
             
  
            
            lb_ncall.setText(hd_principal.con_fecha.resultset.getString("codcall"));
            lb_setor.setText(hd_principal.con_fecha.resultset.getString("nsetor"));
            lb_nmaq.setText(hd_principal.con_fecha.resultset.getString("nmaq"));
            lb_ip.setText(hd_principal.con_fecha.resultset.getString("ipmaq"));
            lb_tipop.setText(hd_principal.con_fecha.resultset.getString("tipop"));
            ta_obs.setText(hd_principal.con_fecha.resultset.getString("descp"));
            lb_nuser.setText(hd_principal.con_fecha.resultset.getString("usuario"));
            lb_tecresp.setText(hd_principal.con_fecha.resultset.getString("tecnicof"));
            lb_tecabert.setText(hd_principal.con_fecha.resultset.getString("tecnico"));
            lb_dataab.setText(hd_principal.con_fecha.resultset.getString("data"));
            lb_horaab.setText(hd_principal.con_fecha.resultset.getString("horarioa"));
            lb_horaf.setText(hd_principal.con_fecha.resultset.getString("horariof"));
            
            datafechado = new String( format.format( hd_principal.con_fecha.resultset.getDate("data") ) );
            lb_dataab.setText(datafechado);
            
            dataabert = new String( format.format( hd_principal.con_fecha.resultset.getDate("dataab") ) );
            lb_dataab1.setText(dataabert);
            
            int drc = (int)hd_principal.con_fecha.resultset.getLong("duracao");
            String dura = (String.valueOf(drc));
            lb_duracao.setText(" "+dura+" DIA(S)");
            
           
            
          
            
        
        }
        catch(SQLException erro)
        {
            if (navega == 1)
            
                JOptionPane.showMessageDialog(null,"Este é o primeiro registro!");
               
            else if (navega == 2)
           
                JOptionPane.showMessageDialog(null,"Este é o último registro!");
                
             else
                //JOptionPane.showMessageDialog(null,"Não localizou dados , é aqui "+erro);
                
            navega = 0;
            
       }
       
         
}
}



      
            

